
/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"968449E0-BFE3-4538-AE7D-BE53FB374D54"}
 */
function onShow(firstShow, event) {
	databaseManager.setAutoSave(false)
	camposVisibles()
	controller.newRecord()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2F3F73CE-AAE0-484A-9938-FA6AFEA4CFB5"}
 */
function confirmar(event) {
	if (databaseManager.saveData())
	{
		var $sol = pantallas_to_soluciones.soluciones_to_rel_solucion_usuario
		var $form = pantallas_to_rel_pantallas_usuarios
		var $cant = databaseManager.getFoundSetCount($sol)
		
		for (var i = 1 ; i <= $cant ; i++)
		{
			var $rcd = $sol.getRecord(i)
			
			$form.newRecord()
			$form.modificable = 1
			$form.visible = 1
			$form.nrogrupotree = nrogrupotree
			$form.orden_aparicion = orden_aparicion
			$form.solucion_id = id_solucion
			$form.usuario_id = $rcd.usuario_id
		}
		application.closeAllWindows()
	}
	else
	{
		globals.DIALOGS.showWarningDialog('Error','Hubo un error en la grabación','OK')
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E989A701-99BE-4014-A369-871C67E650EC"}
 */
function cancelar(event) {
	application.closeAllWindows()
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"571442F7-5ACF-48B7-BC6F-4BFE891287F5"}
 */
function onHide(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	return true
}
